home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / cstrings.arc / STRREPT.C < prev    next >
Encoding:
Text File  |  1985-08-06  |  1.3 KB  |  51 lines

  1. /*
  2.     CSTRINGS.LBR VERSION 1.0
  3.     Spark Software, Inc.
  4.  
  5.         If you find this software of use, it is requested that you send
  6.         a donation ($10.00 suggested) to:
  7.  
  8.             Spark Software, Inc.
  9.             24 Royal Crest Dr., #5
  10.             Nashua, NH  03060
  11.  
  12.         Upon receiving your donation, your name will be added to the 
  13.         List of Registered Users, and future updates can be obtained
  14.         from the SPARKIE RBBS at (603) 888-8179.
  15.  
  16.         If you include an extra $10.00 with your donation, the newest
  17.         version of CSTRINGS.LBR will be mailed to you.
  18.  
  19.         Call SPARKIE RBBS at the number above for other Spark Software
  20.         products!!!
  21. */
  22.  
  23. /*
  24.  *    char *
  25.  *    strrept (str, n, c)
  26.  *    char *str;
  27.  *    int n, c;
  28.  *
  29.  *    This function returns a pointer to a string (str) consisting of n
  30.  *    occurences of character c.  The string is assumed to be large
  31.  *    enough to hold the result.
  32.  */
  33.  
  34. char *strrept (str, n, c)
  35. register char *str;
  36. register int n, c;
  37. {
  38.                     /* First make sure that it is
  39.                        a null terminated string */
  40.         str[n + 1] = '\0';
  41.  
  42.                     /* Loop through, and fill the
  43.                        new string with character c */
  44.     while (n > 0)
  45.         str[--n] = (char) c;
  46.  
  47.                     /* Return the pointer to the result */
  48.     return (str);
  49.  
  50. } /* strrept */
  51.